<template>
	<view>
		<web-view v-if="showSubWeb" :webview-styles="webviewStyles" :src="locaUrl" @message="receiveMsg"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				locaUrl: '',
				showSubWeb: false,
				webviewStyles: {
					height: '100%',
					progress: {
						color: '#FF3333'
					}
				}
			};
		},
		methods: {
			receiveMsg(e) {
				console.log(e);
				if (e.detail.data[0].action === 'close') {
					this.showSubWeb = false;
					uni.navigateBack()
				}
			},
			playVideo(url) {
				this.locaUrl = `/hybrid/html/videoPlayer/videoPlayer.html?url=${encodeURIComponent(url)}`;
				this.showSubWeb = true;
			}
		},
		onLoad({
			url
		}) {
			// 示例：如何播放视频
			this.playVideo(url);
		},
		// mounted() {
		// 	// 示例：如何播放视频
		// 	this.playVideo('https://wjf-5866.oss-cn-hongkong.aliyuncs.com/test/test.mp4');
		// }
	}
</script>

<style>
	/* 自定义样式 */
</style>